#include "surface.h"

/*** Constructor ***/
Surface::Surface()
{
	height = 0;
	width = 0;
}

/*** Constructor ***/
Surface::Surface(unsigned int pWidth, unsigned int pHeight)
{
	initialize(pWidth, pHeight);
}

/*** Initialize a surface ***/
void Surface::initialize(unsigned int pWidth, unsigned int pHeight)
{
	height = pHeight;
	width = pWidth;
	contents = std::vector<unsigned char>(height * width);
}

/*** Get the surface's height ***/
unsigned int Surface::getHeight()
{
	return height;
}

/*** Get the surface's width ***/
unsigned int Surface::getWidth()
{
	return width;
}

/*** Set the square contents at x, y ***/
void Surface::setSquareValue(unsigned int x, unsigned int y, unsigned char value)
{
	contents.at(x + (width * (height - 1 - y))) = value;
}

/*** Get the square contents at x, y ***/
unsigned char Surface::getSquareValue(unsigned int x, unsigned int y)
{
	return contents.at(x + (width * (height - 1 - y)));
}

/*** Deconstructor ***/
Surface::~Surface()
{
}
